version=1.4

# 构建
bash gradlew clean shadowJar || exit

# 用于构建时的镜像
docker build -t kotlin-tools:"$version" . || exit

# 上传
docker tag kotlin-tools:"$version" ccr.ccs.tencentyun.com/shaco_work/kotlin-tools:latest || exit
docker push ccr.ccs.tencentyun.com/shaco_work/kotlin-tools:latest || exit

docker tag kotlin-tools:"$version" ccr.ccs.tencentyun.com/shaco_work/kotlin-tools:"$version" || exit
docker push ccr.ccs.tencentyun.com/shaco_work/kotlin-tools:"$version" || exit

# 删除上传成功
docker rmi ccr.ccs.tencentyun.com/shaco_work/kotlin-tools:latest || exit
docker rmi ccr.ccs.tencentyun.com/shaco_work/kotlin-tools:"$version" || exit